#include "effecteventmanager.h"

namespace VrDataCore
{
	EffectEventManager::EffectEventManager()
	{}

	EffectEventManager::~EffectEventManager()
	{}

	bool EffectEventManager::mousePushedLeft(float x,float y)
	{
		for(int i=0;i<_eventsVector.size();++i)
		{
			if(_eventsVector.at(i)._eventType == EVENT_MOUSE_PUSH_LEAF)
			{
				PramBase* pram = new Parm2<float,float>(x,y);
				_eventsVector.at(i)._fun->callFunc(pram);
			}
		}
		return true;
	}

	bool EffectEventManager::mousePushedRight(float x,float y)
	{
		for(int i=0;i<_eventsVector.size();++i)
		{
			if(_eventsVector.at(i)._eventType == EVENT_MOUSE_PUSH_RIGHT)
			{
				PramBase* pram = new Parm2<float,float>(x,y);
				_eventsVector.at(i)._fun->callFunc(pram);
			}
		}
		return true;
	}

	bool EffectEventManager::mousePushedMiddle(float,float)
	{
		return true;
	}

	bool EffectEventManager::mouseReleasedLeft(float,float)
	{
		return true;
	}

	bool EffectEventManager::mouseReleasedRight(float,float)
	{
		return true;
	}

	bool EffectEventManager::mouseReleasedMiddle(float,float)
	{
		return true;
	}

	bool EffectEventManager::pointerDrag(float,float)
	{
		return true;
	}

	bool EffectEventManager::pointerMove(float x,float y)
	{
		for(int i=0;i<_eventsVector.size();++i)
		{
			if(_eventsVector.at(i)._eventType == EVENT_MOUSE_MOVE)
			{
				PramBase* pram = new Parm2<float,float>(x,y);
				_eventsVector.at(i)._fun->callFunc(pram);
			}
		}
		return true;
	}

	bool EffectEventManager::mouseScroll(float,float)
	{
		return true;
	}

	bool EffectEventManager::setPointerXY(float,float)
	{
		return true;
	}

	void EffectEventManager::reset()
	{
		_eventsVector.clear();
	}

	bool EffectEventManager::keyDown(float,float,int)
	{
		return true;
	}

	bool EffectEventManager::keyUp(float,float,int)
	{
		return true;
	}

	bool EffectEventManager::frame(osg::ref_ptr<osgGA::GUIEventAdapter> ea,osgGA::GUIActionAdapter* aa)
	{
		for(int i=0;i<_eventsVector.size();++i)
		{
			if(_eventsVector.at(i)._eventType == EVENT_FRAME)
			{
				PramBase* pram = new Parm2<osg::ref_ptr<osgGA::GUIEventAdapter>,osgGA::GUIActionAdapter*>(ea,aa);
				_eventsVector.at(i)._fun->callFunc(pram);
			}
		}
		return false;
	}

	bool EffectEventManager::handle(osg::ref_ptr<osgGA::GUIEventAdapter> ea,osgGA::GUIActionAdapter* aa)
	{
		return true;
	}
}